from aip import AipBodyAnalysis

""" 你的 APPID AK SK """
APP_ID = '18608539'
API_KEY = 'a5aca6768d344067a9e563a7f000aa0d'
SECRET_KEY = 'b1fa353db4de44e1992fb0c72166dc9c'

client = AipBodyAnalysis(APP_ID, API_KEY, SECRET_KEY)   # 连接接口

""" 读取图片 """
def get_file_content(filePath):
    with open(filePath, 'rb') as fp:
        return fp.read()

image = get_file_content('7.jpg')       # 传入图片

""" 调用人体检测与属性识别 """
client.bodyAttr(image)

""" 如果有可选参数 """
options = {}
# options["type"] = "gender,age"

""" 带参数调用人体检测与属性识别 """
data = client.bodyAttr(image, options)
# print(data)
res = data['person_info'][0]['attributes']

for k,v in res.items():
    print(k,v['name'])

